//
//  EOSService.h
//  Bees
//
//  Created by NowYouCanSee on 2019/1/8.
//  Copyright © 2019 xiaohan. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "EOSAccountResult.h"
#import "BlockChainInfo.h"
#import <JavaScriptCore/JavaScriptCore.h>
#import "TokenInfo.h"
#import "TokenProjectModel.h"
@interface WalletError : NSObject
@property (nonatomic,assign) NSInteger walletCode;
@property (nonatomic,assign) NSInteger errorCode;
@property (nonatomic,copy) NSString*errorName;
@property (nonatomic,copy) NSString*errorMessage;
@end


NS_ASSUME_NONNULL_BEGIN

@interface EOSService : NSObject
///当前要请求的钱包 如果z没有值就默认为当前主钱包
@property (nonatomic,strong) Wallet*wallet;

@property (nonatomic,strong) EOSAccountInfo*accountResult;

@property (nonatomic,strong) NSArray<TokenInfo*>*symbols;

///交易之后返回的transaction_id
@property (nonatomic,copy) NSString*transaction_id;
///失败的error
@property (nonatomic,strong) WalletError*error;

///签署交易
///收款人
@property (nonatomic,copy) NSString*actor;
@property (nonatomic,copy) NSString*binargs;
@property (nonatomic,copy) NSString*ref_block_num;
///区块编号获取区块详情
@property (nonatomic,copy) NSString*timestamp;
@property (nonatomic,copy) NSString*ref_block_prefix;
@property (nonatomic,strong) NSData*chain_id;
@property (nonatomic,copy) NSString*privateKey;
@property (nonatomic, copy) NSString *expiration;

@property (nonatomic,strong) NSArray*available_keys;

@property (nonatomic,copy) NSString*action;
@property (nonatomic,strong) JSContext *context;

@property (nonatomic,copy) NSString*permission;
//////合约名称
@property (nonatomic,copy) NSString*account;


///提交交易
@property(nonatomic, copy) NSString *signatureStr;
@property(nonatomic, copy) NSString *packed_trx;

///抵押资源
@property(nonatomic, copy) NSString *stake_net_quantity;
@property(nonatomic, copy) NSString *stake_cpu_quantity;
@property(nonatomic, copy) NSString *toUser;
///租借 or 过户
@property(nonatomic, assign) BOOL isMortgage;

///内存
@property(nonatomic, copy) NSString *ram_quant;
///单位Byte
@property(nonatomic, strong) NSNumber *sell_ram;
///ram单价
@property(nonatomic, strong) NSString *ram_balance;
///我的token列表
@property (nonatomic,strong) NSMutableArray<TokenInfo*>*myTokenList;
@property (nonatomic,strong) NSString * max_valuation;
@property (nonatomic,strong) TokenProjectModel *tokenProjectModel;
///多笔
@property (nonatomic,strong) NSArray *binargsArr;


///账号详情
- (void)getAccountInfoComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///获取账号余额  
- (void)getAccountCurrencyBalanceCode:(NSString*)code account:(NSString*)account symbol:(NSString*)symbol complete:(void(^)(BOOL success,NSString*errorMsg,TokenInfo*tokenInfo))complete;
///获取账号code
//- (void)getAccountCurrencyCodeComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///转账
- (void)transferFrom:(NSString*)from To:(NSString*)to quantity:(NSString*)quantity memo:(NSString*)memo complete:(void(^)(BOOL success,NSString*errorMsg))complete;;

///A以mortgage租借(是为租借 否为过户)的形式为B抵押资源
- (void)mortgageResourcesComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///赎回
- (void)redemptionResourcesComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///买内存
- (void)buyRamComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///出售
- (void)sellRamComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///获取RAM价格
- (void)getRammarketComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///
- (void)signTransactionComplete:(void(^)(NSString*signatureStr))complete;
- (void)abiJsonTobinParameters:(NSDictionary*)parame complete:(void(^)(BOOL success,NSString*errorMsg))complete;
- (void)abiBinJsonToParameters:(NSDictionary*)parame complete:(void(^)(BOOL success,NSString*errorMsg,NSDictionary*json))complete;
- (void)pushTransactionComplete:(void(^)(BOOL success,BOOL executed,NSString*errorMsg))complete;
- (void)getBlockInfoComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
- (void)getTableRowsParme:(NSDictionary*)parame complete:(void(^)(BOOL success,NSString*errorMsg,id data))complete;

///我的token列表
- (void)getMyTokenListComplete:(void(^)(BOOL success,NSString*errorMsg))complete;
///项目详情
- (void)getTokenInfoByTokenId:(NSString *)tokenId complete:(void(^)(BOOL success,NSString*errorMsg))complete;
///账号授权
- (void)excuteSignatureMessageForScatterWithActor:(Wallet *)wallet signatureMessage:(NSString *)messageStr complete:(void(^)(BOOL success,NSString*errorMsg))complete;
///
- (void)getTransactionDetailInfoComplete:(void(^)(BOOL success,XHBaseModel * data,NSString*errorMsg))complete;
@end

NS_ASSUME_NONNULL_END
